package com.gzwh.weblib.bean;


import android.os.Parcel;
import android.os.Parcelable;

import lombok.Data;

import java.util.ArrayList;

import java.util.List;

/**
 * 主要负责外设设备上的菜品查看模型
 * 负责处理数据库查询后的处理结果
 */
@Data
public class MenuFoodModel implements Parcelable {
    //商品id
    private String foodId;
    //商品名称
    private String name;

    private String oneOrgCode;

    private String channelId;
    //商品分类
    private String menuCateId;

    private String monthSale;

    private int maxSale;

    private int isDel;

    private int sort;

    private int isShow;

    private int isBenefit;

    private int isHot;

    private int isNew;

    private String delTime;

    private String pic;

    private String desc;

    private List<Sku> skuList;

    public MenuFoodModel() {
    }

    @Override
    public int describeContents() {
        return 0;
    }


    public MenuFoodModel(Parcel in) {
        foodId = in.readString();
        name = in.readString();
        oneOrgCode = in.readString();
        channelId = in.readString();
        menuCateId = in.readString();
        monthSale = in.readString();
        maxSale = in.readInt();

        isDel = in.readInt();
        sort = in.readInt();
        isShow = in.readInt();
        isBenefit = in.readInt();
        isHot = in.readInt();
        isNew = in.readInt();
        delTime = in.readString();
        pic = in.readString();
        desc = in.readString();
        skuList = new ArrayList<Sku>();
        in.readList(skuList, getClass().getClassLoader());
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(foodId);
        dest.writeString(name);
        dest.writeString(oneOrgCode);
        dest.writeString(channelId);
        dest.writeString(menuCateId);
        dest.writeString(monthSale);
        dest.writeInt(maxSale);

        dest.writeInt(isDel);
        dest.writeInt(sort);
        dest.writeInt(isShow);
        dest.writeInt(isBenefit);
        dest.writeInt(isHot);
        dest.writeInt(isNew);
        dest.writeString(delTime);
        dest.writeString(pic);
        dest.writeString(desc);
        dest.writeList(skuList);
    }

    public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
        @Override
        public MenuFoodModel createFromParcel(Parcel source) {

            return new MenuFoodModel(source);
        }

        @Override

        public MenuFoodModel[] newArray(int size) {
            return new MenuFoodModel[size];
        }
    };


    @Data
    public static class Sku implements Parcelable{
        private String skuId;
        private String skuName;
        private String price;
        //库存
        private int stock;
        //最大库存
        private int maxStock;
        //是否自动库存补足,1为自动补足
        private int autoStock;
        //打包费
        private String packingCharge;
        private int minSelect;
        private int maxSelect;

        public Sku() {
        }

        @Override
        public int describeContents() {
            return 0;
        }


        public Sku(Parcel in) {
            skuId = in.readString();
            skuName = in.readString();
            price = in.readString();
            stock = in.readInt();
            maxStock = in.readInt();
            autoStock = in.readInt();
            packingCharge = in.readString();
            minSelect = in.readInt();
            maxSelect = in.readInt();
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(skuId);
            dest.writeString(skuName);
            dest.writeString(price);
            dest.writeInt(stock);
            dest.writeInt(maxStock);
            dest.writeInt(autoStock);
            dest.writeString(packingCharge);
            dest.writeInt(minSelect);
            dest.writeInt(maxSelect);
        }

        public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
            @Override
            public Sku createFromParcel(Parcel source) {

                return new Sku(source);
            }
            @Override

            public Sku[] newArray(int size) {
                return new Sku[size];
            }
        };

        public String getSkuId() {
            return skuId;
        }

        public void setSkuId(String skuId) {
            this.skuId = skuId;
        }

        public String getSkuName() {
            return skuName;
        }

        public void setSkuName(String skuName) {
            this.skuName = skuName;
        }

        public String getPrice() {
            return price;
        }

        public void setPrice(String price) {
            this.price = price;
        }

        public int getStock() {
            return stock;
        }

        public void setStock(int stock) {
            this.stock = stock;
        }

        public int getMaxStock() {
            return maxStock;
        }

        public void setMaxStock(int maxStock) {
            this.maxStock = maxStock;
        }

        public int getAutoStock() {
            return autoStock;
        }

        public void setAutoStock(int autoStock) {
            this.autoStock = autoStock;
        }

        public String getPackingCharge() {
            return packingCharge;
        }

        public void setPackingCharge(String packingCharge) {
            this.packingCharge = packingCharge;
        }

        public int getMinSelect() {
            return minSelect;
        }

        public void setMinSelect(int minSelect) {
            this.minSelect = minSelect;
        }

        public int getMaxSelect() {
            return maxSelect;
        }

        public void setMaxSelect(int maxSelect) {
            this.maxSelect = maxSelect;
        }
    }


    public String getFoodId() {
        return foodId;
    }

    public void setFoodId(String foodId) {
        this.foodId = foodId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getOneOrgCode() {
        return oneOrgCode;
    }

    public void setOneOrgCode(String oneOrgCode) {
        this.oneOrgCode = oneOrgCode;
    }

    public String getChannelId() {
        return channelId;
    }

    public void setChannelId(String channelId) {
        this.channelId = channelId;
    }

    public String getMenuCateId() {
        return menuCateId;
    }

    public void setMenuCateId(String menuCateId) {
        this.menuCateId = menuCateId;
    }

    public String getMonthSale() {
        return monthSale;
    }

    public void setMonthSale(String monthSale) {
        this.monthSale = monthSale;
    }

    public int getMaxSale() {
        return maxSale;
    }

    public void setMaxSale(int maxSale) {
        this.maxSale = maxSale;
    }

    public int getIsDel() {
        return isDel;
    }

    public void setIsDel(int isDel) {
        this.isDel = isDel;
    }

    public int getSort() {
        return sort;
    }

    public void setSort(int sort) {
        this.sort = sort;
    }

    public int getIsShow() {
        return isShow;
    }

    public void setIsShow(int isShow) {
        this.isShow = isShow;
    }

    public int getIsBenefit() {
        return isBenefit;
    }

    public void setIsBenefit(int isBenefit) {
        this.isBenefit = isBenefit;
    }

    public int getIsHot() {
        return isHot;
    }

    public void setIsHot(int isHot) {
        this.isHot = isHot;
    }

    public int getIsNew() {
        return isNew;
    }

    public void setIsNew(int isNew) {
        this.isNew = isNew;
    }

    public String getDelTime() {
        return delTime;
    }

    public void setDelTime(String delTime) {
        this.delTime = delTime;
    }

    public String getPic() {
        return pic;
    }

    public void setPic(String pic) {
        this.pic = pic;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public List<Sku> getSkuList() {
        return skuList;
    }

    public void setSkuList(List<Sku> skuList) {
        this.skuList = skuList;
    }
}
